/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved.
 * ubs-engine is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *          http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef UBSE_CONF_ERROR_KEY_OFFSETH
#define UBSE_CONF_ERROR_KEY_OFFSETH
#include "ubse_error.h"

/* **************************************** */
/* 配置模块错误码定义                         */
/* **************************************** */
// 配置错误码起始码
#define UBSE_CONF_ERROR_START (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x00))
// 配置错误码最大值,F0(240个)表示最大错误码数量上限
#define UBSE_CONF_ERROR_END (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x00) | (0xF0))

// section级错误码始止位
#define UBSE_CONF_ERROR_SECTION_OFFSET (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x00) | 0x50)
#define UBSE_CONF_ERROR_SECTION_END (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x00) | 0x7F)

// key级错误码始止位
#define UBSE_CONF_ERROR_KEY_OFFSET (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x00) | 0x80)
#define UBSE_CONF_ERROR_KEY_OFFSETKEY_END (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x00) | 0xBF)

// value级错误码始止位
#define UBSE_CONF_ERROR_KEY_OFFSETVALUE_OFFSET (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x00) | 0xC0)
#define UBSE_CONF_ERROR_KEY_OFFSETVALUE_END (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x00) | 0xEF)


/** 一般错误码 **/
/* 0x10021000 目录打不开 */
#define UBSE_CONF_ERROR_KEY_OFFSETDIR_OPEN_ERROR (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x00))

/* 0x10021001 文件打不开 */
#define UBSE_CONF_ERROR_KEY_OFFSETFILE_OPEN_ERROR (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x01))

/* 0x10021002 配置目录深度超过最大限制 */
#define UBSE_CONF_ERROR_KEY_OFFSETDIR_TOO_DEEP (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x02))

/* 0x10021003 配置管理模块未加载 */
#define UBSE_CONF_ERROR_KEY_OFFSETCONFIG_MODULE_LOAD_FAIL (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x03))

/* 0x10021006 路径规范化失败 */
#define UBSE_CONF_ERROR_KEY_OFFSETPATH_CANONICALIZATION_FAILED (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x06))

/* 0x10021007 内存分配失败 */
#define UBSE_CONF_ERROR_KEY_OFFSETMEMORY_ALLOCATION_FAILED (UBSE_MID_HI16(UBSE_CONF_MID) | UBSE_ERROR_USERNO(0x07))

/** section级别错误码 **/
/* 0x10021050 section不存在(cli感知) */
#define UBSE_CONF_ERROR_KEY_OFFSETCONFIG_NO_SECTION (UBSE_CONF_ERROR_SECTION_OFFSET | 0x00)

/* 0x10021051 section超长或超短(cli感知) */
#define UBSE_CONF_ERROR_KEY_OFFSETSECTION_ILLEGAL_LENGTH (UBSE_CONF_ERROR_SECTION_OFFSET | 0x01)

/* 0x10021052 section存在非法字符(cli感知) */
#define UBSE_CONF_ERROR_KEY_OFFSETSECTION_HAVE_ILLEGAL_CHAR (UBSE_CONF_ERROR_SECTION_OFFSET | 0x02)

/* 0x10021053 prefix不存在(cli感知) */
#define UBSE_CONF_ERROR_KEY_OFFSETCONFIG_NO_PREFIX (UBSE_CONF_ERROR_SECTION_OFFSET | 0x03)

/* 0x10021054 prefix含有非法字符(cli感知) */
#define UBSE_CONF_ERROR_KEY_OFFSETPREFIX_ILLEGAL_CHAR (UBSE_CONF_ERROR_SECTION_OFFSET | 0x04)

/* 0x10021055 prefix超长(cli感知) */
#define UBSE_CONF_ERROR_KEY_OFFSETPREFIX_TOO_LONG (UBSE_CONF_ERROR_SECTION_OFFSET | 0x05)

/* 0x100210056 prefix中无内容(cli感知) */
#define UBSE_CONF_ERROR_KEY_OFFSETCONFIG_PREFIX_NO_CONTENT (UBSE_CONF_ERROR_SECTION_OFFSET | 0x06)

/** key级别错误码 **/
/* 0x10021080 key不存在 */
#define UBSE_CONF_ERROR_KEY_OFFSETCONFIG_NO_KEY (UBSE_CONF_ERROR_KEY_OFFSET | 0x00)

/* 0x10021081 key超长或超短 */
#define UBSE_CONF_ERROR_KEY_OFFSETKEY_ILLEGAL_LENGTH (UBSE_CONF_ERROR_KEY_OFFSET | 0x01)

/* 0x10021082 key存在非法字符 */
#define UBSE_CONF_ERROR_KEY_OFFSETKEY_HAVE_ILLEGAL_CHAR (UBSE_CONF_ERROR_KEY_OFFSET | 0x02)

/** value级别错误码 **/
/* 0x100210C0 value超长或空(cli感知) */
#define UBSE_CONF_ERROR_KEY_OFFSETVALUE_ILLEGAL_LENGTH (UBSE_CONF_ERROR_KEY_OFFSETVALUE_OFFSET | 0x00)

/* 0x100210C3 不支持的类型 */
#define UBSE_CONF_ERROR_KEY_OFFSETUNSUPPORTED_TYPE (UBSE_CONF_ERROR_KEY_OFFSETVALUE_OFFSET | 0x03)

/* 0x100210C4 查询的值超过类型的最大值 */
#define UBSE_CONF_ERROR_KEY_OFFSETVALUE_OUT_OF_RANGE (UBSE_CONF_ERROR_KEY_OFFSETVALUE_OFFSET | 0x04)

/* 0x100210C5 类型无法转化 */
#define UBSE_CONF_ERROR_KEY_OFFSETCONVERT_ERROR (UBSE_CONF_ERROR_KEY_OFFSETVALUE_OFFSET | 0x05)

/* 0x100210C6 含有非法字符 */
#define UBSE_CONF_ERROR_KEY_OFFSETVALUE_HAVE_ILLEGAL_CHAR (UBSE_CONF_ERROR_KEY_OFFSETVALUE_OFFSET | 0x06)

#endif // UBSE_CONF_ERROR_KEY_OFFSETH
